import request from '@/utils/request'

/**
 * @description 父公司查询
 * @param {String} commonId
 * @returns
 */
export function getParentCompanyById(commonId) {
  return request({
    url: '/tissue/commonController/queryParentCompany',
    method: 'get',
    params: { commonId }
  })
}

/**
 * @description 公司查询
 * @param {String} params
 * @returns
 */
export function getCompanyById(params) {
  return request({
    url: '/tissue/commonController/queryCompany',
    method: 'get',
    params
  })
}

/**
 * @description 区域查询
 * @param {String} params
 * @returns
 */
export function getAreaByCompanyId(params) {
  console.log('params', params)
  if (!params.companyId) return

  return request({
    url: '/tissue/commonController/queryArea',
    method: 'get',
    params
  })
}

/**
 * @description 线路查询
 * @param {String} params
 * @returns
 */
export function getRouteByAreaId(params) {
  if (!params.areaId) return

  return request({
    url: '/tissue/commonController/queryRoute',
    method: 'get',
    params
  })
}

/**
 * @description 点位查询
 * @param {String} params
 * @returns
 */
export function getPointByRouteId(params) {
  if (!params.routeId) return

  return request({
    url: '/tissue/commonController/queryPosition',
    method: 'get',
    params
  })
}

/**
 * @description 点位类型
 * @param {String} params
 * @returns
 */
export function getAllPointType(params) {
  return request({
    url: '/tissue/commonController/queryPositionType',
    method: 'get',
    params
  })
}

/**
 * @description 用户
 * @param {Object} params
 * @returns
 */
export function getUserByCompany(params) {
  return request({
    url: '/tissue/commonController/queryUser',
    method: 'get',
    params
  })
}

/**
 * @description 根据用户编号获取授权角色
 * @param {Number} params
 * @returns
 */
export function getRoleApi(params) {
  return request({
    url: '/system/user/getUserByRoleId',
    method: 'get',
    params
  })
}

/**
 * @description 根据角色编号获取详细信息
 * @param roleId
 * @returns
 */
export function getRoleIdApi(params) {
  return request({
    url: '/system/role',
    method: 'get',
    params
  })
}
